package alarm;

public class Detector implements Observable{
	private Observer observer;
	public Detector() {
		observer=null;
	}
	public void setObserver(Observer obs) {
		if ( observer!=null )
			throw new RuntimeException("Attempt to register twice!");
		else
			observer=obs;
	}
	public void alarm(String str)
	{
		observer.notifyEvent(new Event(str));
	}

}
